import { createRouter, createWebHashHistory } from 'vue-router'
import { useAuthStore } from '@/stores/auth'
import login_routes from './login'
import frame_routes from './frame'


const router = createRouter({
  history: createWebHashHistory(import.meta.env.BASE_URL),
  routes: frame_routes.concat(login_routes)
})

router.beforeEach((to,from)=>{
  const authStore = useAuthStore()
  if(!authStore.is_logined && to.name!= 'Login')
    return {name:'Login'}
})

export default router
